<?php

	$type = request('type',false,true);
	require_once $_site->get_handlepath('info');
	$title=$type==1?"在线留言":"联系我们";
	$hover[$type]='class="hover"';
	require_once $_site->get_viewpath("wap/commom/header");

	if($type == 1){
		$page = request('page',false,true,false,1);
		require_once $_site->get_handlepath('guest_book');
		$list = guest_book_fun_list(array('cat'=>1,'isreply'=>1,'hidden_flag'=>0),$page,5);
		if($list['rows']){
			$urlparam = '/wap/contact&type=1';
			$pagination = "<span><font style='color:red'>$page</font>/{$list['page_count']}</span>".page_method($list['row_count'],$page,$list['page_count'],0,$urlparam,false);
		}
	}

?>

<script type="text/javascript" charset="utf-8" src="/plugin/cooperation_unit/artdialog/jquery.artDialog.source.js?skin=default"></script>
<script type="text/javascript" language="javascript">
loader.file({
		plugin:['validform/main','dialog/main'],
			js:['city_area', 'html','sms_send']
	});
	$(function (){

var form_obj=$("#form1").Validform({
	   tiptype: function(msg, o, cssctl){
		   if(!o.obj.is("form")){
			   /*var obj = o.obj.parent("td").find('tt');
			   cssctl(obj, o.type);
			   obj.text(msg);*/
		   }
	   },
	   ajaxPost:true,
	   callback:function (data){
			var k =art.dialog({
				id:'id1',
				title:false,
				content:"<div>"+data.msg+"</div>",
				cancel:false,
				fixed:true,
				lock:true,
				close:function (){
					if(data.state){
						location.href="/wap/contact&type=1";
					}
				}
			}).time(3);
	   }
	});
	})
</script>
<body style=" padding-bottom:60px; background: #ffffff;">
	<div class="top"><a href="/wap/index" class="arrow_carrot-left return"></a><?php echo $title;?></div>

	<div class="jm_top_one">
		<ul>
			<li><a <?php echo $hover[1];?> href="/wap/contact&type=1">在线留言</a></li>
			<li><a <?php echo $hover[2];?> href="/wap/contact&type=2">联系我们</a></li>
		</ul>
	</div>
	<div class="jm_contact">
		<?php
			if($type==1){
				?>
				<form action="/handle.php" method="post" id='form1'>
				<input type="hidden" name="h" value="guest_book/add_dis">
				<ul>
					<li><span class="col_1">称呼：</span><div class="col_2 ly_pt"><input name="name" type="text" id="name" class="cinput" datatype="*" nullmsg="请输入姓名"/></div></li>
					<li><span class="col_1">电话：</span><div class="col_2 ly_pt"><input name="phone" type="text" id="phone" class="cinput" datatype="m" nullmsg="请输入11位手机号" errormsg="请输入11位手机号"/></div></li>
					<!--<li><span class="col_1">标题：</span><div class="col_2 ly_pt"><input name="title" type="text" id="title" size="64" class="cinput" datatype="*" nullmsg="主题不能为空"/></div></li>-->
					<li><span class="col_1">内容：</span><div class="col_2 ly_txt"><textarea cols="" rows="" name="content" datatype="*" nullmsg="留言内容不能为空"></textarea></div></li>
					<li><span class="col_1">验证码：</span><div class="col_2 ly_txt"><input class="yzm" type="text" name="auth_code" value="">
<span class="auth_code"><img style="cursor: pointer; vertical-align:text-bottom;" id="codeimg" src="/handle.php?h=auth_code/entry&height=25&width=100&size=14" onClick="this.src=this.src+'&k='+Math.random()" alt="验证码" /></span></div></li>
					<li><span class="col_1">&nbsp;</span><div class="col_2 ly_bt"><input name="" type="submit" value="提 交"></div></li>
				</ul>
				</form>
				<?php
			}else{
				?>

				<?php
			}
		?>
	</div>
	<?php
		if($type==1){
			?>
			<?php
			if($list['rows']){
				foreach($list['rows'] as $row){
					?>
					<div class="mesgge">
						<ul>

							<!--<li><span class="col_1">主题：</span><div class="col_2"  style=" font-weight:bolder;"><?php echo $row['title']."[".$row['posttime']."]"; ?><?php echo ($row['topnumber']=="1")?"【精华】":''; ?></div></li>-->
							<li><span class="col_1">留言人：</span><div class="col_2"><?php echo $row['user_name'];  ?></div></li>
							<li><span class="col_1">留言：</span><div class="col_2"><?php echo strip_tags( htmlspecialchars_decode($row['content'])); ?></div></li>
							<li><span class="col_1">回复：</span><div class="col_2" style=" color:#FF0000;"><?php echo strip_tags( htmlspecialchars_decode($row['replycontent'])); ?></div></li>
						</ul>
					</div>
					<?php
				}
				?>
				<div class="page">
	<?php echo $pagination ?>
</div>
				<?php
			}
		}
	?>

	<?php require_once $_site->get_viewpath("wap/commom/footer");?>
</body>
</html>
